<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>e-MarioSakoban:  Fichier source de /home/ychoucha/cours_IUT/Programmation/C/sakoban_project/main.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Généré par Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Page&nbsp;principale</span></a></li>
      <li><a href="annotated.html"><span>Structures&nbsp;de&nbsp;données</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
    </ul>
  </div>
<h1>/home/ychoucha/cours_IUT/Programmation/C/sakoban_project/main.c</h1><a href="main_8c.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">main.c</span>
<a name="l00003"></a>00003 <span class="comment">------</span>
<a name="l00004"></a>00004 <span class="comment">Issa</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">Rôle : menu du jeu. Permet de choisir entre l'éditeur et le jeu lui-même.</span>
<a name="l00007"></a>00007 <span class="comment">*/</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="allInclude_8h.html">allInclude.h</a>"</span>
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="main_8c.html#b1f4254096ff851363dbcd70dcf004c7">00012</a> <span class="keywordtype">void</span> <a class="code" href="main_8c.html#b1f4254096ff851363dbcd70dcf004c7">key_down</a>(<span class="keywordtype">void</span> *data, Evas *e, Evas_Object *obj, <span class="keywordtype">void</span> *event_info)
<a name="l00013"></a>00013 {
<a name="l00014"></a>00014         
<a name="l00015"></a>00015         <span class="comment">// on caste data dans ecran</span>
<a name="l00016"></a>00016         Ecore_Evas  *ecran;
<a name="l00017"></a>00017     ecran = (Ecore_Evas*)data;
<a name="l00018"></a>00018     
<a name="l00019"></a>00019     Evas_Event_Key_Down *event;
<a name="l00020"></a>00020     <span class="keyword">event</span> = (Evas_Event_Key_Down *)event_info;
<a name="l00021"></a>00021 
<a name="l00022"></a>00022     printf(<span class="stringliteral">"touche préssé: %s\n"</span>, event-&gt;keyname);
<a name="l00023"></a>00023 
<a name="l00024"></a>00024     <span class="keywordflow">if</span> ( !strcmp(event-&gt;keyname, <span class="stringliteral">"Escape"</span>) )
<a name="l00025"></a>00025     {
<a name="l00026"></a>00026           ecore_main_loop_quit();
<a name="l00027"></a>00027         }
<a name="l00028"></a>00028 
<a name="l00029"></a>00029     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(event-&gt;keyname, <span class="stringliteral">"a"</span>))
<a name="l00030"></a>00030     {
<a name="l00031"></a>00031             
<a name="l00032"></a>00032                 <a class="code" href="jeu_8h.html#ae6bf2cd704ed0499f852ea33576a5e0">jouer</a>(ecran,e,obj);
<a name="l00033"></a>00033         printf(<span class="stringliteral">"Jouer\n"</span>);
<a name="l00034"></a>00034     }
<a name="l00035"></a>00035     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcmp(event-&gt;keyname, <span class="stringliteral">"z"</span>))
<a name="l00036"></a>00036     {
<a name="l00037"></a>00037         <a class="code" href="editeur_8h.html#ad9a7791fc5b9703cc7e7c365c313e53">editeurLevel</a>(ecran,e,obj);
<a name="l00038"></a>00038        
<a name="l00039"></a>00039          printf(<span class="stringliteral">"Editeur\n"</span>);
<a name="l00040"></a>00040     }
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="main_8c.html#e66f6b31b5ad750f1fe042a706a4e3d4">00043</a> <span class="keywordtype">int</span> <a class="code" href="main_8c.html#e66f6b31b5ad750f1fe042a706a4e3d4">main</a>()
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 
<a name="l00046"></a>00046     Ecore_Evas  *ecran;
<a name="l00047"></a>00047     Evas        *evas;
<a name="l00048"></a>00048     Evas_Object *fondEcran;
<a name="l00049"></a>00049 
<a name="l00050"></a>00050     <span class="keywordtype">int</span> iw, ih;
<a name="l00051"></a>00051 
<a name="l00052"></a>00052     <span class="keywordflow">if</span> (!ecore_evas_init ())
<a name="l00053"></a>00053         <span class="keywordflow">return</span> -1;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055     ecran = ecore_evas_new (<span class="stringliteral">"software_x11"</span>, 0, 0, <a class="code" href="constantes_8h.html#6068a247ff9ece1b0a9773c58144906c">LARGEUR_FENETRE</a>, <a class="code" href="constantes_8h.html#fd1a1e285af564b849b17498e82e1a41">HAUTEUR_FENETRE</a>, NULL);
<a name="l00056"></a>00056 
<a name="l00057"></a>00057     <span class="keywordflow">if</span> (!ecran)
<a name="l00058"></a>00058     {
<a name="l00059"></a>00059         ecore_evas_shutdown ();
<a name="l00060"></a>00060         <span class="keywordflow">return</span> -1;
<a name="l00061"></a>00061     }
<a name="l00062"></a>00062 
<a name="l00063"></a>00063     ecore_evas_show (ecran);
<a name="l00064"></a>00064     ecore_evas_title_set(ecran, <span class="stringliteral">"Mario Sokoban"</span>);
<a name="l00065"></a>00065     evas = ecore_evas_get (ecran);
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 
<a name="l00068"></a>00068     fondEcran = evas_object_image_add (evas);
<a name="l00069"></a>00069     evas_object_focus_set(fondEcran, 1);
<a name="l00070"></a>00070     evas_object_image_file_set (fondEcran, <span class="stringliteral">"../imgs/menu.jpg"</span>, NULL);
<a name="l00071"></a>00071       
<a name="l00072"></a>00072     evas_object_image_size_get(fondEcran, &amp;iw, &amp;ih);
<a name="l00073"></a>00073     evas_object_image_size_set(fondEcran, iw, ih);
<a name="l00074"></a>00074     evas_object_image_fill_set(fondEcran, 0, 0, iw, ih);
<a name="l00075"></a>00075     evas_object_resize (fondEcran, iw, ih);
<a name="l00076"></a>00076     evas_object_show (fondEcran);
<a name="l00077"></a>00077 
<a name="l00078"></a>00078         
<a name="l00079"></a>00079         
<a name="l00080"></a>00080 
<a name="l00081"></a>00081     evas_object_event_callback_add(fondEcran, EVAS_CALLBACK_KEY_DOWN, <a class="code" href="main_8c.html#b1f4254096ff851363dbcd70dcf004c7">key_down</a>, &amp;ecran);
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00085"></a>00085     ecore_main_loop_begin();
<a name="l00086"></a>00086   
<a name="l00087"></a>00087 
<a name="l00088"></a>00088     ecore_evas_shutdown ();
<a name="l00089"></a>00089     <span class="keywordflow">return</span> EXIT_SUCCESS;
<a name="l00090"></a>00090 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Généré le Sun Apr 5 18:14:18 2009 pour e-MarioSakoban par&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
